package com.vshop.service.aspecial.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * 支付结果到达服务器之后需要做的事情
 *
 * @author lm
 * @date 2020/9/19 1:15
 */
@Component
@Slf4j
public class AfterPayDeal {
    private static final String UN_RE_ORDER = "un_re_order:";
    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 将支付结果交易编码放入到redis队列中
     *
     * @param payId
     */
    public void addPayIdToRedis(String payId) {
        redisTemplate.opsForValue().set(UN_RE_ORDER + payId, payId, 7, TimeUnit.DAYS);
        log.info(payId + ":作为值放入成功");
    }
}
